package com.winit.feature.model;


import javax.persistence.Column;
import java.io.Serializable;

public class FeatureHistoryId  implements Serializable {
    @Column(name = "feature_id")
    private String featureId;
    @Column(name = "version")
    private String version;

    public String getFeatureId() {
        return featureId;
    }

    public void setFeatureId(String featureId) {
        this.featureId = featureId;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }


    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((featureId == null) ? 0 : featureId.hashCode());
        result = PRIME * result + ((version == null) ? 0 : version.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj){
        if(this == obj){
            return true;
        }
        if(obj == null){
            return false;
        }
        if(getClass() != obj.getClass()){
            return false;
        }
        FeatureHistoryId featureHistoryId = (FeatureHistoryId)obj;
        boolean equal = true;
        if (version == null){
            equal = version == featureHistoryId.getVersion();
        }else {
            equal = this.version.equals(featureHistoryId.getVersion());
        }
        if (!equal){
            return equal;
        }

        if (featureId == null){
            equal = this.featureId == featureHistoryId.getFeatureId();
        }else {
            equal = this.featureId.equals(featureHistoryId.getFeatureId());
        }

        return equal;
    }
}
